package com.dw.dwdzcommerce.view.details;

import com.dw.dwdzcommerce.R;
import com.dw.dwdzcommerce.base.activity.BaseActivity;

import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class ActionBarLayout {

	private BaseActivity mContext;
	private TextView mTypes;
	private TextView mSearch;

	public void initModule(BaseActivity activity) {
		this.mContext = activity;
		mTypes = (TextView) mContext.findViewById(R.id.fragment_actionbar_main_back_tv);
		mSearch = (TextView) mContext.findViewById(R.id.fragment_actionbar_main_search_tv);
		mTypes.setText("返回");

		mSearch.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (mListener != null) {
					mListener.onSearchClick(v);
				}
			}
		});
		mTypes.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (mListener != null) {
					mListener.onBackClick(v);
				}
			}
		});

	}

	private OnActionBarClickListener mListener;

	public void setmListener(OnActionBarClickListener mListener) {
		this.mListener = mListener;
	}

	public interface OnActionBarClickListener {
		void onSearchClick(View v);

		void onBackClick(View v);
	}

}
